<?php
session_start();
include_once("../service/productService.php");
include_once("../util/constant.php");
include_once("../util/FTP.php");

$name = $_POST["name"];
$imgPath = $_POST["imgPath"];
$proStatId = createProductStatus($name, $imgPath); 

if($proStatId > 0){
    if(IS_ON_SERVER) FTP::getInstance()->ftpMakeDir(FTP::getInstance()->getServerPath()."product-status/".$proStatId, 0777);
    else mkdir("../image/product-status/".$proStatId, 0777);
    
    echo "<script>window.location.href = '../admin/product-status-detail.php?action=".INSERT_SUCCESSFULLY."&id=".$proStatId."';</script>";
}
else
    echo "<script>window.location.href = '../admin/product-status-detail.php?action=".INSERT_FAILED."';</script>";
?>